Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
404 error when performing "Get" request to API

Trying to perform a "get" request to API. I know the API will return the data when I do the "get" from Postman. So I believe the problem is with my HTML.

<!DOCTYPE html>
<html>
<body>
    <h1>My First Heading</h1>
    <p>My first paragraph.</p>

        <script>
            const Http = new XMLHttpRequest();
            const url='https://localhost:44369';
            Http.open("GET", url);
            Http.send();

            Http.onreadystatechange = (e) => {
            console.log(Http.responseText)
            }

        </script>
</body>
</html>

Here's the API method I'm trying to "get" from:

    //https://localhost:44369/api/Request
    [EnableCors("AllowLocalhostOrigins")]
    [HttpGet]
    public ActionResult GetText()
    {
       string a = "b";

        return Ok(a);
    }

Here's the error I'm getting: 404 Not Found

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

After doing some more reading, I see that it's a problem with the API and not the html code I posted this question about. The html code I posted works fine.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!